﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<SDT.Admin.ViewModels.MailCategoryInputModel>" %>
<%@ Import Namespace="SDT.Lib.Helpers" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Chi tiết chuyên mục
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<%if (ViewData["MessageInfo"] == null)
  { %>
<% using (Html.BeginForm("edit", "mailcategory", FormMethod.Post, new { id = "adminForm" }))
   {%>
    <%= Html.ValidationSummary(true)%>
    
    <fieldset>
        <legend>Chi tiết chuyên mục</legend>
        <table class="admintable">
            <tbody>
                <tr>
                    <td class="key">
                        Phân mục cha
                    </td>
                    <td>
                        <%= Model.Category.ParentID.HasValue ? Model.Category.MailCategoryParent.Name : string.Empty %>
                    </td>
                </tr>
                <tr>
                    <td class="key">
                        Tên phân mục 
                    </td>
                    <td>
                        <%= Model.Category.Name %>
                    </td>
                </tr>
                <tr>
                    <td class="key">Trạng thái kích hoạt</td>
                    <td><%=Html.RadioButtonFor(m=>m.Category.PubYN, true, Model.Category.PubYN == true ? new { @checked = "checked" } : null)%> Kích hoạt
                    <%=Html.RadioButtonFor(m => m.Category.PubYN, false, Model.Category.PubYN == false ? new { @checked = "checked" } : null)%> Không kích hoạt</td>
                </tr>
                <tr>
                    <td class="key">Ngày thêm</td>
                    <td>
                       <%= Model.Category.AddDate.ToString("dd/MM/yyyy") %>
                    </td>
                </tr>           
                <tr>
                    <td class="key">
                        Người thêm
                    </td>
                    <td>
                        <%= Model.Category.aspnet_User.UserName %>
                    </td>
                </tr>

            </tbody>
        </table>
        <p>
            <input type="submit" value="Lưu thay đổi" />
        </p>
    </fieldset>
    <% }
  } %>
    
    <script type="text/javascript">
        $(document).ready(function() {
            $("#adminForm").validate({
                rules: {
                Category_Name: { required: true }
                },
                message: {
                Category_Name: "Bạn phải nhập tên chuyên mục."
                }
            });
        });

    </script>
    
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="Toolbar" runat="server">
	<%= Html.Toolbar("Sửa", string.Format("/mailcategory/edit/{0}", Model.Category.ID), "edit")%>
	<%= Html.Toolbar("Xóa", string.Format("/mailcategory/delete/{0}", Model.Category.ID), "delete")%>
	<%= Html.Toolbar("Quay về", "/mailcategory" , "back") %>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="Header" runat="server">
    Chi tiết chuyên mục
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="Message" runat="server">
<%=ViewData["MessageInfo"]!=null? "<p class='perror'>"+Html.Encode(ViewData["MessageInfo"])+"</p>":string.Empty%> 
</asp:Content>
